import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'assistant_logic.dart';
import '../../shared/shared.dart';
import '../../widgets/widgets.dart';

class Two extends GetView<AssistantLogic> {
  static const style = TextStyle(
    fontSize: 20,
    fontWeight: FontWeight.w600,
    color: Colors.white,
  );

  static const textStyle = TextStyle(
      color: Color(0xFFC66548), fontSize: 20, fontWeight: FontWeight.bold);

  static const write =
      TextStyle(color: ColorConstants.themeColor, fontSize: 20);

// Image for second page
  final Widget abstractImage = Image.asset(
    'assets/images/1.png',
    fit: BoxFit.cover,
  );

  Two({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Column(
        mainAxisSize: MainAxisSize.max,
        children: [
          _back(),
          CommonWidget.rowHeight(height: 30),
          _logo(),
          CommonWidget.rowHeight(height: 20),
          const Text("创建VIVA", style: style),
          CommonWidget.rowHeight(height: 20),
          _main(),
          CommonWidget.rowHeight(height: 30),
          _done()
        ],
      ),
    );
  }

  BlindButton _done() {
    return BlindButton(
        onTap: () {
          CommonWidget.toast('创建成功');
          Get.back();
        },
        width: 113,
        height: 39,
        text: '确定',
        fontSize: 20,
        color: Colors.transparent);
  }

  Container _main() {
    return Container(
      width: 260,
      height: 340,
      decoration: BoxDecoration(
          color: ColorConstants.themeColor.withOpacity(0.50),
          border: Border.all(color: ColorConstants.themeColor),
          borderRadius: const BorderRadius.all(Radius.circular(15))),
      child: Container(
        padding: const EdgeInsets.all(20),
        child: Column(
          children: [
            _viva(),
            CommonWidget.rowHeight(height: 10),
            _vivaEdite(),
            CommonWidget.rowHeight(height: 8),
            _num(),
            CommonWidget.rowHeight(height: 8),
            _last('星座:'),
            CommonWidget.rowHeight(height: 8),
            _last('性别:'),
          ],
        ),
      ),
    );
  }

  Row _last(String text) {
    return Row(children: [
      Text(
        text,
        style: textStyle,
      ),
      CommonWidget.rowWidth(width: 10),
      const Expanded(
          child: SizedBox(
              height: 30,
              child: TextField(
                  decoration: InputDecoration(
                      border: UnderlineInputBorder(
                          borderSide: BorderSide(color: Color(0xFFE48465))),
                      enabledBorder: UnderlineInputBorder(
                        borderSide: BorderSide(color: Color(0xFFE48465)),
                      ),
                      focusedBorder: UnderlineInputBorder(
                          borderSide: BorderSide(color: Color(0xFFE48465)))))))
    ]);
  }

  Row _num() {
    return Row(children: [
      const Text('编号:', style: textStyle),
      CommonWidget.rowWidth(width: 10),
      const Expanded(child: Center(child: Text('356984', style: write)))
    ]);
  }

  Row _vivaEdite() {
    return Row(children: [
      const Text('名称:', style: textStyle),
      CommonWidget.rowWidth(width: 10),
      const Text(
        'VIVA---',
        style: write,
      ),
      CommonWidget.rowWidth(width: 10),
      const Expanded(
          child: SizedBox(
              height: 30,
              child: TextField(
                  decoration: InputDecoration(
                      border: UnderlineInputBorder(
                          borderSide: BorderSide(color: Color(0xFFE48465))),
                      enabledBorder: UnderlineInputBorder(
                        borderSide: BorderSide(color: Color(0xFFE48465)),
                      ),
                      focusedBorder: UnderlineInputBorder(
                          borderSide: BorderSide(color: Color(0xFFE48465)))))))
    ]);
  }

  SizedBox _viva() {
    return const SizedBox(
        width: 121,
        height: 121,
        child: Image(image: AssetImage(AssetsURL.viva)));
  }

  SizedBox _logo() {
    return const SizedBox(
        height: 86,
        width: 86,
        child: Image(image: AssetImage(AssetsURL.logoURL)));
  }

  Row _back() {
    return Row(children: [
      CommonWidget.rowWidth(width: 15),
      IconButton(
          onPressed: () => Get.back(),
          icon: const Icon(Icons.arrow_back_ios,
              size: 35, color: ColorConstants.themeColor))
    ]);
  }
}
